/* cSnesPointer.h
 * Conversions between SNES and file addresses.
 */
#ifndef __newmoon_csnespointer_h
#define __newmoon_csnespointer_h

class SNESPointer;
#include <stdio.h>
#include "mathx.h"
#include "uint.h"
#include "cROMFile.h"

class SNESPointer {
	public:
		typedef enum {
			LOROM,
			HIROM, //NOT IMPLEMENTED
			NUM_ROM_MAPPINGS
		} ROMMapping;
		SNESPointer();
		SNESPointer(u32 FileAddr);
		SNESPointer(u8 Bank, u16 Addr);
		~SNESPointer();
		bool Read(ROMFile *File, u32 Addr);
		bool Read2Byte(ROMFile *File, u32 Addr);
		bool Read2Byte(ROMFile *File, u32 Addr, u8 Bank);
		void SetFileAddr(u32 Addr);
		void SetSNESAddr(u8 Bank, u16 Addr);
		u32 ToFileAddr();
		u32 ToSNESAddr();
		u32 ToRAMAddr();
		SNESPointer operator+(const u16 Addr);
		void operator+=(const u16 Addr);
	
	protected:
		u8 Bank;
		u16 Addr;
		ROMMapping Mapping;
		u32 HeaderSize, BankSize;
	
	private:
};

#endif //__newmoon_csnespointer_h
